package com.cn;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;

import com.cn.pool.NioSelectorRunnablePool;

/**
 * 启动函数
 *
 * @author -琴兽-
 */
public class Start {

    public static void main(String[] args) {

        //newCachedThreadPool()方法会创建线程池，类型是Runnable
        //初始化线程池，Executor的实例对象可以异步执行线程池每个线程对应的任务
        NioSelectorRunnablePool nioSelectorRunnablePool = new NioSelectorRunnablePool(Executors.newCachedThreadPool(), Executors.newCachedThreadPool());

        //获取服务类
        ServerBootstrap bootstrap = new ServerBootstrap(nioSelectorRunnablePool);

        //绑定端口
        bootstrap.bind(new InetSocketAddress(10101));

        System.out.println("start");
    }

}
